package top.huhuiyu.myforum.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyAppConfing implements WebMvcConfigurer {

  private static final Logger LOG = LoggerFactory.getLogger(MyAppConfing.class);

  @Override
  public void addCorsMappings(CorsRegistry registry) {
  	LOG.info("MyAppConfing.addCorsMappings");
    WebMvcConfigurer.super.addCorsMappings(registry);
    registry.addMapping("/**").allowedMethods("*").allowedOrigins("*").allowedHeaders("*").allowCredentials(false);
  }
}